﻿using System;
using System.Collections.Generic;
using System.Text;
using Zhuang.Utility.Common.DataBase;

namespace Zhuang.DAL
{
    public class Sys_MaxNumberDAL
    {
        public string GetMaxNumber(string prefix,string midFlag)
        {

            string strSql = "";
            if (midFlag != string.Empty)
            {
                strSql = string.Format(@"declare @number varchar(15)
            exec sp_getmaxnumber '{0}',@number output,'{1}'
            select @number", prefix, midFlag);
            }
            else
            {
                strSql = string.Format(@"declare @number varchar(15)
            exec sp_getmaxnumber '{0}',@number output
            select @number", prefix);
            }


            return SqlHelper.Query(strSql).Tables[0].Rows[0][0].ToString().Trim();

        }

        public string GetMaxNumber(string prefix)
        {
            return GetMaxNumber(prefix,string.Empty);
        }
    }
}
